//go:build ignore

package main

import "fmt"

var ch = make(chan bool, 1)

func main() {
	i := 0
	//ch <- false
	for {
		select {
		case r := <-ch:
			fmt.Println("read", r)
			goto end
		default:
			i += 1
			go func(c chan bool) {
				if i == 10 {
					c <- false
				}
			}(ch)
		}
	}
end:
	fmt.Println(i)
}
